package com.room.controller.init;

import com.room.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @创建人 lin
 * @创建时间 2019/10/6
 * @描述
 */
@RestController
@RequestMapping("/init/data")
public class InitdataController {
    @Autowired
    CollegeService collegeService;
    @Autowired
    ApartmentService apartmentService;
    @Autowired
    ClassesService classesService;

    @Autowired
    TeacherService teacherService;

    @Autowired
    ManagerService managerService;

    @RequestMapping(value = "/initdata",method = RequestMethod.GET)
    public Map<String,Object> getInitData(){
        Map<String,Object> map = new HashMap<>();
        map.put("apartments",apartmentService.getAllApartment());
        map.put("classes",classesService.getAllClasses());
        map.put("colleges",collegeService.getAllCollege());
        map.put("teachers",teacherService.getTeacherInit());
        return map;
    }

    @RequestMapping(value = "/managerInit",method = RequestMethod.GET)
   public Map<String,Object> getManagerInit(){
        Map<String,Object> map = new HashMap<>();
       map.put("managerInit",managerService.getManagerInit());
       return map;

   }
}
